const express = require('express')
const app = express()
const indexRouter = require('./routes/index');
const usersRouter = require('./routes/users');
const homeRouter = require('./routes/home');
app.use(express.json())
app.use(require('cors')()) //解决跨域
console.log(__dirname);
app.use('/uploads', express.static(__dirname + '/uploads'));
app.use('/article', express.static(__dirname + '/article'));
app.use('/', indexRouter);
app.use('/users', usersRouter);
app.use('/admin/api', homeRouter);
/**
 * 引用路由
 */
/**
 * 上传接口
 */

require('./routes/uploads.js')(app)
app.listen(3000,function(){
    console.log('app listening on port 3000 http://localhost:3000')
})